<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>page 1</title>
    <link rel="stylesheet" href="./css/开始界面.css">
    <style>
        * {
            padding: 0;
            margin: 0;
            font-size: 2vmin;
        }

        div {
            display: flex;
            justify-content: center;
            align-items: center;
        }

        body {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
            height: 100vh;
            background:url("./img/壁纸.png");
            background-attachment: fixed;
            background-size: cover;
        }

        .title {
            font-family: sans-serif;
            font-size: 10rem;
            color: #c1975d;
            font-weight: 900;
            cursor: pointer;
        }

        .title span {
            font-size: 10rem;
            color: #e5d4be;
        }

        .loading {
            position: fixed;
            flex-direction: column;
            top: 0;
            left: 0;
            width: 100%;
            height: 100vh;
            background-color: #e3d2bd;
            z-index: 100000000;
            transition: 1s ease;
        }

        .loading svg {
            width: 5rem;
            margin-bottom: 2rem;
            overflow: visible;
            transition: 0.3s ease;
        }

        .loading svg circle {
            fill: none;
            stroke: #e5d4be;
            stroke-width: 12;
            stroke-dasharray: 160;
            stroke-dashoffset: 160;
            transform-origin: center;
            animation: circle_rotate 3s ease-in infinite;
        }

        @keyframes circle_rotate {
            0% {
                transform: rotate(0deg);
                stroke-dashoffset: 160;
            }

            100% {
                transform: rotate(360deg);
                stroke-dashoffset: -160;
            }
        }

        .loading p {
            font-family: sans-serif;
            font-size: 2rem;
            color: #171717;
            font-weight: 900;
            transition: 0.3s ease;
        }

        .loading_out {
            transform: translateY(100%);
        }

        .loading_out svg,
        .loading_out p {
            opacity: 0;
        }

    </style>
</head>

    <!-- 加载动画进入 -->
<body>
<p onclick="loading.in('./游戏规则.html')" class="title">记忆<span>翻翻乐</span>
</p>
<!-- 加载动画 -->
    <div class="loading">
    <div class="loader">
        <div></div>
        <div></div>
        <div></div>
        <div></div>
    </div>
</body>
<!-- js -->
<script>
    const loading = {
        container: document.querySelector(".loading"),
        // 进入加载
        in(target) {
            this.container.classList.remove("loading_out");
            setTimeout(() => {
                window.location.href = target;
            }, 2000)
        },
        // 退出加载
        out() {
            this.container.classList.add("loading_out");
        }
    };
    window.addEventListener("load", () => {
        loading.out();
    })
</script>

</html>
